#include "faceTreeItem.h"

FaceTreeItem::FaceTreeItem(QTreeWidgetItem *_parentItem, Face *_f) : TreeItem(_parentItem), f(_f){
    setFlags(Qt::ItemIsSelectable);
    QString str = "Face ";
    str.append(QString::number(f->getID()));
    setText(0, str);

    if(f->isSelected()) setSelected(true);
    else setSelected(false);
}

FaceTreeItem::~FaceTreeItem(){
}

void FaceTreeItem::updateFace(Face *_f){
    f = _f;
}

Face *FaceTreeItem::getFace(){
    return f;
}

void FaceTreeItem::select(){
    if(f->isSelected()){
        f->select(false);
        setSelected(false);
    }else{
        f->select(true);
        setSelected(true);
    }
    emit selected(f);
}
